/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SessionBeans.logs;

import SessionBeans.actions.OperationTypeEnum;
import entities.OperationType;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

/**
 *
 * @author Tomas
 */
@Stateless
@LocalBean
public class OperatioTypeSessionBean {

    @PersistenceContext(unitName = "tCloudEE-ejbPU")
    private EntityManager em;

    public OperationType load(OperationTypeEnum operationTypeEnum) {
        TypedQuery<OperationType> createQuery = em.createQuery("Select OBJECT(u) from OperationType u where u.type LIKE '" + operationTypeEnum.name()+ "'", OperationType.class);
        return createQuery.getSingleResult();
    }
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
